package cn.edu.lcu.cs.designpattern.adapter.object;

import cn.edu.lcu.cs.designpattern.adapter.clazz.Adaptee;


/**
 * 对象适配器类，通过调用持有（组合）对象的方法进行适配
 */
public class Adapter implements Target {
    private Adaptee1 adaptee1;
    private Adaptee2 adaptee2;

    public Adapter() {
        adaptee1 = new Adaptee1();
        adaptee2 = new Adaptee2();
    }

    @Override
    public void operation1() {
        adaptee1.operation1();
    }

    @Override
    public void operation2() {
        adaptee2.operation2();
    }

    @Override
    public void operation3() {
        System.out.println("Method in adapter.");
    }
}
